package com.alibaba.weex.module;

import com.nat.device_volume.HLModuleResultListener;
import com.nat.device_volume.HLVolumeModule;
import com.taobao.weex.annotation.JSMethod;
import com.taobao.weex.bridge.JSCallback;
import com.taobao.weex.common.WXModule;


/**
 * 音量模块
 *
 * @version 1.0
 * @since 2017/7/2
 */
public class DeviceVolumeModule extends WXModule {

    @JSMethod
    public void get(final JSCallback jsCallback) {
        HLVolumeModule.getInstance(mWXSDKInstance.getContext()).get(new HLModuleResultListener() {
            @Override
            public void onResult(Object o) {
                jsCallback.invoke(o);
            }
        });
    }

    @JSMethod
    public void set(float volume, final JSCallback jsCallback) {
        HLVolumeModule.getInstance(mWXSDKInstance.getContext()).set(volume, new HLModuleResultListener() {
            @Override
            public void onResult(Object o) {
                jsCallback.invoke(o);
            }
        });
    }
}
